<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
class PHPExcel_Chart_DataSeriesValues
{
    private $dataType;
    private $dataSource;
    private $formatCode;
    private $pointMarker;
    private $pointCount = 0;
    private $dataValues = [];
    private static $dataTypeValues = ["String", "Number"];
    const DATASERIES_TYPE_STRING = "String";
    const DATASERIES_TYPE_NUMBER = "Number";
    public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = NULL, $formatCode = NULL, $pointCount = 0, $dataValues = [], $marker = NULL)
    {
        $this->setDataType($dataType);
        $this->dataSource = $dataSource;
        $this->formatCode = $formatCode;
        $this->pointCount = $pointCount;
        $this->dataValues = $dataValues;
        $this->pointMarker = $marker;
    }
    public function getDataType()
    {
        return $this->dataType;
    }
    public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
    {
        if(!in_array($dataType, self::$dataTypeValues)) {
            throw new PHPExcel_Chart_Exception("Invalid datatype for chart data series values");
        }
        $this->dataType = $dataType;
        return $this;
    }
    public function getDataSource()
    {
        return $this->dataSource;
    }
    public function setDataSource($dataSource = NULL, $refreshDataValues = true)
    {
        $this->dataSource = $dataSource;
        if($refreshDataValues) {
        }
        return $this;
    }
    public function getPointMarker()
    {
        return $this->pointMarker;
    }
    public function setPointMarker($marker = NULL)
    {
        $this->pointMarker = $marker;
        return $this;
    }
    public function getFormatCode()
    {
        return $this->formatCode;
    }
    public function setFormatCode($formatCode = NULL)
    {
        $this->formatCode = $formatCode;
        return $this;
    }
    public function getPointCount()
    {
        return $this->pointCount;
    }
    public function isMultiLevelSeries()
    {
        if(0 < count($this->dataValues)) {
            return is_array($this->dataValues[0]);
        }
        return NULL;
    }
    public function multiLevelCount()
    {
        $levelCount = 0;
        foreach ($this->dataValues as $dataValueSet) {
            $levelCount = max($levelCount, count($dataValueSet));
        }
        return $levelCount;
    }
    public function getDataValues()
    {
        return $this->dataValues;
    }
    public function getDataValue()
    {
        $count = count($this->dataValues);
        if($count == 0) {
            return NULL;
        }
        if($count == 1) {
            return $this->dataValues[0];
        }
        return $this->dataValues;
    }
    public function setDataValues($dataValues = [], $refreshDataSource = true)
    {
        $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
        $this->pointCount = count($dataValues);
        if($refreshDataSource) {
        }
        return $this;
    }
    private function stripNulls($var)
    {
        return $var !== NULL;
    }
    public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true)
    {
        if($this->dataSource !== NULL) {
            $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
            $newDataValues = PHPExcel_Calculation::unwrapResult($calcEngine->_calculateFormulaValue("=" . $this->dataSource, NULL, $worksheet->getCell("A1")));
            if($flatten) {
                $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
                foreach ($this->dataValues as &$dataValue) {
                    if(!empty($dataValue) && $dataValue[0] == "#") {
                        $dataValue = 0;
                    }
                }
                unset($dataValue);
            } else {
                $cellRange = explode("!", $this->dataSource);
                if(1 < count($cellRange)) {
                    $cellRange = $cellRange[1];
                }
                $dimensions = PHPExcel_Cell::rangeDimension(str_replace("\$", "", $cellRange));
                if($dimensions[0] == 1 || $dimensions[1] == 1) {
                    $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
                } else {
                    $newArray = array_values(array_shift($newDataValues));
                    foreach ($newArray as $i => $newDataSet) {
                        $newArray[$i] = [$newDataSet];
                    }
                    foreach ($newDataValues as $newDataSet) {
                        $i = 0;
                        foreach ($newDataSet as $newDataVal) {
                            array_unshift($newArray[$i++], $newDataVal);
                        }
                    }
                    $this->dataValues = $newArray;
                }
            }
            $this->pointCount = count($this->dataValues);
        }
    }
}

?>